package com.itlong.cloud.noncore.operate;

/**
 * <desc>
 *      运营-APP管理-套餐管理业务处理暴露接口实现类
 * </desc>
 *
 * @createDate 2017/11/01
 */

import com.itlong.cloud.POJO.DTO.operate.OperateAppPackageGetPageDTO;
import com.itlong.cloud.POJO.PO.AppPackagePO;
import com.itlong.cloud.POJO.VO.operate.OperateAppPackageGetPageVO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient("non-core-service")
public interface IOperateAppPackageServiceClient {
    /**
     * <desc>
     *      保存功能
     * </desc>
     *
     * @param appPackagePO 套餐实体
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/11/01
     */
    @RequestMapping(path = "/operate/appManage/package/save")
    String save(@RequestBody AppPackagePO appPackagePO) throws Exception;

    /**
     * <desc>
     *      更新功能
     * </desc>
     *
     * @param appPackagePO 套餐实体
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/11/01
     */
    @RequestMapping(path = "/operate/appManage/package/update")
    Integer update(@RequestBody AppPackagePO appPackagePO) throws Exception;

    /**
     * <desc>
     *      通过id获取功能
     * </desc>
     *
     * @param appPackagePO 套餐实体
     * @return 套餐实体
     * @author Jiaqi.X
     * @createDate 2017/11/01
     */
    @RequestMapping(path = "/operate/appManage/package/getOne")
    AppPackagePO getOne(@RequestBody AppPackagePO appPackagePO);

    /**
     * <desc>
     *      获取所有套餐
     * </desc>
     *
     * @return 套餐实体集合
     * @author Jiaqi.X
     * @createDate 2017/11/01
     */
    @RequestMapping(path = "/operate/appManage/package/getList")
    List<AppPackagePO> getList();

    /**
     * <desc>
     *      获取分页数据
     * </desc>
     *
     * @param pageDTO 查询参数DTO
     * @return page模型
     * @author Jiaqi.X
     * @createDate 2017/11/01
     */
    @RequestMapping(path = "/operate/appManage/package/getPage")
    Page<OperateAppPackageGetPageVO> getPage(@RequestBody OperateAppPackageGetPageDTO pageDTO) throws Exception;

    /**
     * <desc>
     *      删除功能
     * </desc>
     *
     * @param appPackageIds 套餐id数组
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/09/21
     */
    @RequestMapping(path = "/operate/appManage/package/delete")
    Integer delete(@RequestParam("appPackageIds")String appPackageIds);


    /**
     * <desc>
     *      套餐分配功能
     * </desc>
     *
     * @param appFunctionIds 功能id 多个,号分隔
     * @param appPackageId  套餐id
     * @param systemType 系统类型 1app 2小程序
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/01
     */
    @RequestMapping(path = "/operate/appManage/package/allotFunction")
    Integer allotFunction(@RequestParam(value = "appFunctionIds",required = false)String appFunctionIds,
                          @RequestParam("appPackageId")String appPackageId,
                          @RequestParam("systemType")Integer systemType);

    /**
     * <desc>
     *      套餐分配项目
     * </desc>
     *
     * @param appPackageId 套餐id
     * @param allotProjectIds 待分配的项目id
     * @param projectIds 当前页所有项目id
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/02
     */
    @RequestMapping(path = "/operate/appManage/package/allotPackageProject")
    public Integer allotPackageProject(@RequestParam("appPackageId")String appPackageId,
                                       @RequestParam(value = "allotProjectIds",required = false)String allotProjectIds,
                                       @RequestParam("projectIds")String projectIds) throws Exception;


    /**
     * <desc>
     *      获取当前套餐已有的项目id集合
     * </desc>
     *
     * @param appPackageId 套餐id
     * @return
     * @author Jiaqi.X
     * @createDate 2017/11/02
     */
    @RequestMapping(path = "/operate/appManage/package/getAppPackageProjectIds")
    public List<String> getAppPackageProjectIds(@RequestParam("appPackageId")String appPackageId);

    /**
     * <desc>
     *      获取已绑定套餐的项目id
     * </desc>
     *
     * @param appPackageId app套餐id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/4/3
     */
    @PostMapping("/operate/appManage/package/getOtherProjectIds")
    List<String> getOtherProjectIds(@RequestParam("appPackageId") String appPackageId) throws Exception;

    /**
     * <desc>
     *      根据套餐id获取场景列表
     * </desc>
     *
     * @param appPackageId 套餐
     * @return
     * @Author Zhu.yj
     * @createDate  2021/4/8
     */
    @PostMapping("/operate/appManage/package/getSceneIdByPackageId")
    List<String> getSceneIdByPackageId(@RequestParam("appPackageId") String appPackageId) throws Exception;

    /**
     * <desc>
     *      校验项目是否绑定套餐
     * </desc>
     *
     * @param
     * @return
     * @Author Zhu.yj
     * @createDate  2021/5/19
     */
    @PostMapping("/operate/appManage/package/checkProjectsIsBindPackage")
    List<Map<String, Object>> checkProjectsIsBindPackage(@RequestParam("projectIdList") List<String> projectIdList) throws Exception;
}